package cn.com.stary1993.kite.captcha.support.behavior;


import cloud.tianai.captcha.common.response.ApiResponse;
import cloud.tianai.captcha.generator.ImageCaptchaGenerator;
import cloud.tianai.captcha.generator.common.model.dto.GenerateParam;
import cloud.tianai.captcha.resource.ImageCaptchaResourceManager;
import cloud.tianai.captcha.validator.ImageCaptchaValidator;
import cloud.tianai.captcha.validator.common.model.dto.ImageCaptchaTrack;
import cn.com.stary1993.kite.captcha.store.CacheStore;
import cn.com.stary1993.kite.captcha.vo.BehaviorCaptchaVO;
import cn.com.stary1993.kite.captcha.vo.CaptchaResponse;
import lombok.AllArgsConstructor;

/**
 * 用于SliderCaptcha增加附属功能
 *
 * @author stary1993
 */
@AllArgsConstructor
public class FilterBehaviorImageCaptcha extends BehaviorImageCaptcha {

	protected BehaviorImageCaptcha target;

	@Override
	public CaptchaResponse<BehaviorCaptchaVO> generate() {
		return (CaptchaResponse<BehaviorCaptchaVO>) this.target.generate();
	}

	@Override
	public CaptchaResponse<BehaviorCaptchaVO> generate(String type) {
		return target.generate(type);
	}

	@Override
	public CaptchaResponse<BehaviorCaptchaVO> generate(BehaviorImageCaptchaFormat captchaImageType) {
		return target.generate(captchaImageType);
	}

	@Override
	public CaptchaResponse<BehaviorCaptchaVO> generate(String type, BehaviorImageCaptchaFormat captchaImageType) {
		return target.generate(type, captchaImageType);
	}

	@Override
	public CaptchaResponse<BehaviorCaptchaVO> generate(GenerateParam param) {
		return target.generate(param);
	}

	@Override
	public ApiResponse<?> matching(String id, ImageCaptchaTrack ImageCaptchaTrack) {
		return target.matching(id, ImageCaptchaTrack);
	}

	/**
	 * 兼容一下旧版本，新版本建议使用 {@link BehaviorImageCaptcha#matching(String, ImageCaptchaTrack)}
	 * @param id id
	 * @param percentage 百分比数据
	 * @return boolean
	 */
	@Override
	public boolean matching(String id, Float percentage) {
		return target.matching(id, percentage);
	}

	@Override
	public ImageCaptchaResourceManager getImageCaptchaResourceManager() {
		return target.getImageCaptchaResourceManager();
	}

	@Override
	public ImageCaptchaValidator getImageCaptchaValidator() {
		return target.getImageCaptchaValidator();
	}

	@Override
	public void setImageCaptchaValidator(ImageCaptchaValidator sliderCaptchaValidator) {
		target.setImageCaptchaValidator(sliderCaptchaValidator);
	}

	@Override
	public ImageCaptchaGenerator getImageCaptchaTemplate() {
		return target.getImageCaptchaTemplate();
	}

	@Override
	public void setImageCaptchaTemplate(ImageCaptchaGenerator imageCaptchaGenerator) {
		target.setImageCaptchaTemplate(imageCaptchaGenerator);
	}

	@Override
	public CacheStore getCacheStore() {
		return target.getCacheStore();
	}

	@Override
	public void setCacheStore(CacheStore cacheStore) {
		target.setCacheStore(cacheStore);
	}

}
